import java.lang.reflect.Field;

/**
 * @author: xinmi
 * @date: 2020/11/2
 * @description:
 */
public class AssignableFrom {
    public int i;

    public static void main(String[] args) throws Exception {
        Class<?> myType = String.class;
        Object o = new Bean(1,"sxm","beijing");

        System.out.println("hello");

        for (Field field : o.getClass().getFields()) {
            if (field.getType().isAssignableFrom(myType)) {
                System.out.println("Field " + field + " is assignable from type " + o.getClass());
            }
        }
    }
}
